/***************************************************************************
创建者：林鸿铭
开始时间：               : 2016.11.1
copyright            : (C) 同川科技
修改说明：（每次有修改就添加一条，带有 修改人，修改时间，修改描述）

修改人:林鸿铭
开始时间:2016.11.28
修改描述:delegate整合,工程整合

 ***************************************************************************
 *   示教器主程序
 *                                                                         *
 ***************************************************************************/

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
//通信
#include "../HmiCommunicate/globaldata.h"
#include "../HmiCommunicate/moveoperation.h"
//#include "../HmiCommunicate/hmicommunicate.h" //移交delegate处理
#include "../CommunicateDelegate/communicatedelegate.h"



//消息
#include "hmimessageboxdialog.h"
#include "hmifilmlabel.h"

//界面
#include "../login1/login.h"
#include "../delegate1/delegate.h"

enum MC_COMMAND
{
    ENUM_COMMAND_JOINT = 0,
    ENUM_COMMAND_LINE = 1,
    ENUM_COMMAND_CIRCLE = 2
};



namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    //硬件驱动:获取main()中的指针:主要用于控制键盘的显示与声响

    bool eventFilter(QObject *obj, QEvent *event);

    CommunicateNormalDelegate *communicateNormalThread;

    CommunicateSaveDelegate *communicateSaveThread;


private slots:


    void timeroutslot();

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void setShowInitialLanguage(int language);

public:
    //**********消息框界面**********
    HmiMessageBoxDialog *hmiMsgBox;

    //**********屏蔽膜
    HmiFilmLabel *film;

    //**********data
    GlobalData *globalData;
    GlobalData *ioData;

     MoveOperation *moveOperation;

    //**********thread
//    CommunicateDelegate *lv2Thread;
//    CommunicateDelegate *lv3Thread;
//    QThread *normalThread;
//    QThread *saveThread;

    //
//    TcpClient *heart;

private:
    QTranslator translator;

signals:

    /**
     * @brief hideAllTopView            隐藏所有子页面
     */
    void hideAllTopView();

public slots:
    /**
     * @brief showMsgBoxTypeSlot        显示(普通)消息框
     * @param msgBoxType                有无按钮的类型
     * @param title                     标题
     * @param text                      内容
     */
    void showMsgBoxTypeSlot(int msgBoxType,QString title,QString text);

    void closeMsgBoxSlot();

    /**
     * @brief showMsgBoxNeedReturnTypeSlot  需要返回值的消息框
     * @param msgBoxType                    返回类型(int double float qstring )
     * @param target                        返回目标
     */
    void showMsgBoxNeedReturnTypeSlot(int msgBoxType,int target,QString title,QString text);

    /**
     * @brief showFilmSlot              显示透明膜
     */
    void showFilmSlot();
    void hideFilmSlot();                //隐藏

    /**
     * @brief changeLanguageSlot        语言切换
     * @param language
     */
    void changeLanguageSlot(int language);

public:

private slots:
    void on_checkBox_clicked();

    void on_pushButton_clicked();

    void on_comboBox_currentIndexChanged(int index);

    void on_horizontalScrollBar_rangeChanged(int min, int max);

    void on_pushButton_2_pressed();

    void on_pushButton_2_released();

    void on_horizontalScrollBar_sliderMoved(int position);

    void on_comboBox_activated(int index);

    void on_radioButton_5_clicked();

    void on_radioButton_6_clicked();

    void on_pushButton_12_clicked();

    void on_pushButton_4_pressed();

    void on_pushButton_4_released();

    void on_pushButton_5_pressed();

    void on_pushButton_5_released();

    void on_radioButton_7_clicked();

    void on_radioButton_8_clicked();

    void on_radioButton_9_clicked();

    void on_radioButton_10_clicked();

    void on_pushButton_7_pressed();

    void on_pushButton_7_released();

    void on_pushButton_6_pressed();

    void on_pushButton_6_released();

    void on_pushButton_9_pressed();

    void on_pushButton_9_released();

    void on_pushButton_8_pressed();

    void on_pushButton_8_released();

    void on_pushButton_11_pressed();

    void on_pushButton_11_released();

    void on_pushButton_10_pressed();

    void on_pushButton_10_released();

    void on_pushButton_13_clicked();

    void on_pushButton_14_clicked();

    void on_pushButton_3_pressed();

    void on_pushButton_3_released();

    void on_radioButton_2_clicked();

    void on_radioButton_clicked();

private:
    Ui::MainWindow *ui;
    QTimer *timer;
    int pointType;
    bool do1;
    bool do2;

};

#endif // MAINWINDOW_H
